Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #11396 #11397

Closed
wants to merge 2 commits into from
Closed

Conversation

adam-zlatniczki
Copy link
Contributor

Fixes #11396

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • Title summarizes what is changing.
  • Has a news entry file (remember to thank yourself!).
  • Appropriate comments and documentation strings in the code.
  • Has sufficient logging.
  • Has telemetry for feature-requests.
  • Unit tests & system/integration tests are added/updated.
  • Test plan is updated as appropriate.
  • package-lock.json has been regenerated by running npm install (if dependencies have changed).

* kernelDebugAdapter shouldn't try to convert the file path that it
  receives from the kernel based on the OS where VSCode is run, because
  it leads to files not being found on the kernel side, which in turn
  breaks debugging of a cell
* kernelDebugAdapter shouldn't try to convert the file path that it
  receives from the kernel based on the OS where VSCode is run, because
  it leads to files not being found on the kernel side, which in turn
  breaks debugging of a cell
@ghost
Copy link

ghost commented Sep 16, 2022

CLA assistant check
All CLA requirements met.

Copy link
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the investigation and fix! I see a bunch of places around the debugger that use the path module, and they are all possibly suspicious. You haven't seen any other issues while debugging cross-OS? Also, are you sure there is no scenario where it's needed? I can't think of anything, I found this commit from the PR that originally added it, e9bfc0d, but no explanation unfortunately

@adam-zlatniczki
Copy link
Contributor Author

Thanks for the investigation and fix! I see a bunch of places around the debugger that use the path module, and they are all possibly suspicious. You haven't seen any other issues while debugging cross-OS? Also, are you sure there is no scenario where it's needed? I can't think of anything, I found this commit from the PR that originally added it, e9bfc0d, but no explanation unfortunately

Regarding the kernelDebugAdapter.ts for notebooks, I don't really see any risks: if you search for fileToCell and cellToFile, the only results are in the kernelDebugAdapter and kernelDebugAdapterBase, and they are only used as lookups. Manual testing also didn't reveal any issues for me.

Now that you mentioned it I got curious, so I played around a bit with different setups and debug scenarios. It looks like there's a problem with debugging inside an interactive window kernel too. Judging by a quick glance at the error log, it seems to be something with the path convention too, but I need to dig deeper into this. I'll be getting back to you as soon as I discover something.

@roblourens roblourens added this to the September 2022 milestone Sep 20, 2022
@roblourens
Copy link
Member

I figured out why we have that, it's because dumpCell used to return mixed slashes, \ and / on windows, and those need to be normalized before we use them to set breakpoints. I filed this issue before realizing it was fixed this year: ipython/ipykernel#995 I think we need to keep the code because there will be plenty of users with environments that have the bug.

Instead of calling the generic normalize method, we can do a simple check for whether the path looks like a windows path with a drive letter (matches [a-z]:\\) and call the correct normalize method.

If you see something weird going on with the interactive window too, this call is suspicious

const norm = path.normalize((response as IDumpCellResponse).sourcePath);

@adam-zlatniczki
Copy link
Contributor Author

adam-zlatniczki commented Sep 21, 2022 via email

@roblourens roblourens closed this Sep 21, 2022
@roblourens
Copy link
Member

Continuing in the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cell debug doesn't stop at breakpoints when VSCode is run on Windows but a remote kernel runs on Unix
2 participants